<?php $this->_extends('_layouts/default_layout'); ?>

<?php $this->_block('contents'); ?>

<div class="tabs_title clearfix">
  <h3>社区活动管理</h3>
  
<?php
$this->_control('Admin_SmallTabs', 'small_tabs', array(
	'menu' => '社区活动', 'current' => '社区活动'
));
?>
  
</div>

<div class="block tips">
  <h3>操作提示</h3>
  <ul>
    <li>首先在论坛发帖，然后“<a href="<?php echo url('activities/create'); ?>">添加社区活动</a>”。</li>
	<li>删除主题不会删除该主题对应的论坛帖。</li>
  </ul>
</div>

<form class="adminform" name="deleteform" method="post" action="<?php echo url('activities/update'); ?>">
  <table>
    <tr>
      <th></th>
      <th>显示顺序</th>
      <th>标题</th>
      <th>开始日期</th>
      <th>结束日期</th>
      <th>连接网址</th>
      <th>添加日期</th>
      <th>&nbsp;</th>
    </tr>

<?php foreach ($activities as $activity): ?>

	<tr>
      <td><input class="checkbox" type="checkbox" name="delete[]" value="<?php echo $activity->id(); ?>" /></td>
      <td><input class="txt" type="text" size="6" maxlength="6" name="order_pos[<?php echo $activity->id(); ?>]" value="<?php echo intval($activity->order_pos); ?>" /></td>
	  <td><?php echo h($activity->title); ?></td>
	  <td><?php echo $activity->schedule_begin; ?></td>
	  <td><?php if (!is_null($activity->schedule_end)): echo $activity->schedule_end; else: echo '不限'; endif; ?></td>
      <td><a href="<?php echo $activity->url; ?>" target="_blank"><?php echo mb_strimwidth($activity->url, 0, 50, '...'); ?></a></td>
	  <td><?php echo date('Y-m-d H:i', $activity->created); ?></td>
      <td nowrap="nowrap"><a href="<?php echo url('activities/edit', array('id' => $activity->id())); ?>">编辑</a></td>
    </tr>

<?php endforeach; ?>

	<tr class="nobg">
	  <td>
	    <input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="$('input[name=\'delete[]\']').attr('checked', this.checked);" />
	    <label for="chkall">删?</label>
	  </td>
	  <td colspan="7">
	    <input type="submit" class="btn" name="btnsubmit" value="提交"  />
		&nbsp;&nbsp;&nbsp;
		<a href="<?php echo url('activities/create'); ?>">添加社区活动</a>
	  </td>
	</tr>
  </table>
</form>

<?php $this->_endblock(); ?>
